package Frame.screen;

import FCRendering.FCRConstants;
import FCRendering.FCRMaster;
import FCRendering.ImageUtil;
import FCRendering.sw.FCRValues;
import Frame.entity.UnifyShopSayUIEntity;
import Function.Utils.SwingUtil;
import VWorldGameStudio.FCItem;
import utils.FCMixUtil;
import utils.FCUIConfig;
import utils.entity.UIConfigEntity;

import java.awt.*;
import java.util.Vector;

import static FCRendering.FCRMaster.fcv;

public class DefaultShopScreen extends IScreen {

    Font font1 = new Font(FCRConstants.FONT_ELEGANT_BLACK, 0, (int) (22 * fcv.getProportion()));
    Font font2;
    public DefaultShopScreen() {

    }

    @Override
    public void dispatchPaintComponent(Graphics g, FCRMaster fcrMaster) {
        g.drawImage(ImageUtil.getImage("gamesayshop"), (int) (532 * fcv.getProportion()), 0,
                (int) (856 * fcv.getProportion()), (int) (343 * fcv.getProportion()), this);


        int startX = 556;
        int dx = 0;
        int textY = 0;
        //宽是400  425
         for (int i = 0; i < 7; i++) {
             UnifyShopSayUIEntity leftUi = FCRValues.leftWindowUI[i];
             UnifyShopSayUIEntity rightUi = FCRValues.rightWindowUI[i];

             textY = (int) (60 * fcv.getProportion()+40 * i * fcv.getProportion());
             //左边
             g.setFont(font1);
             g.setColor(Color.white);
             if(fcv.getMouseX() > (int) ((startX)* fcv.getProportion()) && fcv.getMouseX() < (int) ((startX+400)* fcv.getProportion())){
                 if(fcv.getMouseY() > (int)(textY-30*fcv.getProportion())&& fcv.getMouseY() < (int)(textY+10*fcv.getProportion())) {
                     g.setColor(Color.BLUE);
                 }
             }

             dx = (int)(350* fcv.getProportion()-SwingUtil.getStringWidht(leftUi.rightText, font1));
             g.drawString(leftUi.leftText, (int) ((startX+20)* fcv.getProportion()),textY);
             g.drawString(leftUi.rightText,(int) (dx + startX * fcv.getProportion()),textY);

             //右边
             g.setColor(Color.white);
             if(fcv.getMouseX() > (int) ((startX + 425)* fcv.getProportion()) && fcv.getMouseX() < (int) ((startX+ 425+400)* fcv.getProportion())){
                 if(fcv.getMouseY() > (int)(textY-30*fcv.getProportion())&& fcv.getMouseY() < (int)(textY+10*fcv.getProportion())) {
                     g.setColor(Color.BLUE);
                 }
             }

             dx = (int)(350* fcv.getProportion()-SwingUtil.getStringWidht(rightUi.rightText, font1));
             if(i == 0 || i == 1){
                 g.setFont(font2);
                 g.drawString(rightUi.leftText, (int) ((startX+20+425)* fcv.getProportion()),textY);
             }else {
                 g.drawString(rightUi.leftText, (int) ((startX+20+425)* fcv.getProportion()),textY);
             }
             g.drawString(rightUi.rightText,(int) (dx + (startX+425) * fcv.getProportion()),textY);
        }
         if(FCRValues.unifyShopSayShowImg != null){
             g.drawImage(FCRValues.unifyShopSayShowImg, (int) ((startX+425)* fcv.getProportion()),
                     (int) (25 * fcv.getProportion()), (int)(183*fcv.getProportion()), (int)(210*fcv.getProportion()),this);
         }
    }

    @Override
    public void setBounds() {
        font1 = new Font(FCRConstants.FONT_ELEGANT_BLACK, 0, (int) (22 * fcv.getProportion()));
        font2 = new Font(FCRConstants.FONT_ELEGANT_BLACK, 0, (int) (20 * fcv.getProportion()));
    }
}
